package com.heyqing.medium.day7;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * ClassName:MinimumRecolors
 * Package:com.heyqing.medium.day7
 * Description:
 *
 * @Date:2024/10/9
 * @Author:Heyqing
 */
public class MinimumRecolors {
    public int minimumRecolors(String blocks, int k) {
        int min = Integer.MAX_VALUE;
        for (int i = 0; i <= blocks.length() - k; i++) {
            int b = 0;
            for (int j = i; j < i + k; j++) {
                if (blocks.charAt(j) == 'B') b++;
            }
            if (b == k) return 0;
            min = Math.min(min, k - b);
        }
        return min;
    }
}
